import request from '@/utils/request';

const roleApi={
  queryAuthedPermission:'routes',
  rolesInfo:'roles'
}

class Service{
  /**
   * @description POST 保存授权菜单权限
  */
  static postAuthPermission(data: any) {
    return request({
      url: roleApi.queryAuthedPermission,
      method: 'POST',
      json: true,
      data
    }).then((res) => {
        console.log(res);
      if (res.status === 0) {
      return Promise.resolve(res)
      }
      return Promise.reject(res)
    })
  }

 /**
   * @description GET 获取角色信息
  */
  static getRoles() {
    return request({
      url: roleApi.rolesInfo,
      method: 'get',
      json: true,
    }).then((res) => {
      if (res.status === 0) {
      return Promise.resolve(res)
      }
      return Promise.reject(res)
    })
  }

  /**
   * @description POST 添加角色信息
  */
   static postRoles(data:any) {
    return request({
      url: roleApi.rolesInfo,
      method: 'POST',
      json: true,
      data
    }).then((res) => {
      if (res.status === 0) {
      return Promise.resolve(res)
      }
      return Promise.reject(res)
    })
  }
}
export default Service


